package com.infoDiffusion.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.infoDiffusion.bean.EarthquakeBean;
import com.infoDiffusion.dao.EarthquakeStatDao;

@Service
@Transactional(propagation = Propagation.REQUIRED)
public class EarthquakeStatService {
	@Autowired
	private EarthquakeStatDao edao;

	public boolean add(EarthquakeBean ebean) {
		return edao.add(ebean);
	}

	public List list(EarthquakeBean ebean) {
		String hql = "from EarthquakeBean";
		return edao.getList(hql);
	}

	public boolean update(EarthquakeBean ebean) {
		return edao.update(ebean);
	}

	public EarthquakeBean getById(int id) {
		return (EarthquakeBean) edao.getById(EarthquakeBean.class, id);
	}

	public boolean delete(EarthquakeBean ebean) {
		edao.delete(ebean);
		return true;
	}

	public boolean updateById(int id) {
		String hql = "update EarthquakeBean set username=?,password=?,power=?,create_date=?";
		return edao.updateById(hql, id);
	}

}
